Skip to content

feat: support ARM64 musl targets#47

Merged
matthewkeil merged 1 commit into
mainfrom
nflaig/arm64-musl
Jul 10, 2026
Merged

feat: support ARM64 musl targets#47
matthewkeil merged 1 commit into
mainfrom
nflaig/arm64-musl

Conversation

@nflaig

@nflaig nflaig commented Jul 10, 2026

Copy link
Copy Markdown
Member

What changed

  • add aarch64-unknown-linux-musl to the supported target matrix
  • map it to Zig's aarch64-linux-musl target
  • detect ARM64 musl runtimes when resolving native packages
  • generate the correct npm cpu, os, and libc metadata
  • document and test the new target

Why

Consumers such as @chainsafe/lodestar-z currently publish ARM64 glibc and x64 musl binaries, but cannot build or load an ARM64 musl binary. This leaves Alpine Linux on ARM64 without a compatible native package.

Impact

Packages using ZAPI can publish and load ARM64 musl binaries, restoring parity with native packages that already support Alpine on ARM64.

Validation

  • pnpm build:js
  • pnpm lint:js
  • zig build
  • zig build test:zapi
  • pnpm test:js — 93 tests passed

This PR was written with AI assistance.

@matthewkeil matthewkeil marked this pull request as ready for review July 10, 2026 14:20

@nflaig nflaig left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, self-review

@matthewkeil matthewkeil merged commit 0bf4375 into main Jul 10, 2026
5 checks passed
matthewkeil pushed a commit that referenced this pull request Jul 10, 2026
🤖 I have created a release *beep* *boop*
---


##
[3.1.0](zapi-v3.0.0...zapi-v3.1.0)
(2026-07-10)


### Features

* support ARM64 musl targets
([#47](#47))
([0bf4375](0bf4375))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
matthewkeil added a commit to ChainSafe/lodestar-z that referenced this pull request Jul 10, 2026
## What changed

- add `aarch64-unknown-linux-musl` to the Lodestar-Z native package
target matrix
- pin hashtree-z to the merged PIC-enabled commit from
[ChainSafe/hashtree-z#12](ChainSafe/hashtree-z#12)
- pin the Zig ZAPI dependency to the ARM64-musl backport on
`zapi-v2.x.0`
- keep the npm dependency on `@chainsafe/zapi` 2.0.0, apply the matching
target-support backport with a pnpm patch, and bundle the patched
dependency for consumers

## Why

Lodestar currently receives an ARM64 musl binary from `@chainsafe/blst`.
Replacing it with Lodestar-Z without an equivalent artifact would
regress Alpine Linux support on ARM64.

The first real cross-build also exposed non-PIC objects in hashtree-z,
which prevented the native Node.js shared library from linking. The
pinned prerequisite commit fixes that linker failure.

## Dependency chain

- [ChainSafe/zapi#47](ChainSafe/zapi#47) is
backported to `zapi-v2.x.0`
-
[ChainSafe/hashtree-z#12](ChainSafe/hashtree-z#12)
is merged; `build.zig.zon` pins its canonical squash commit using `zig
fetch --save=hashtree`

## Validation

- complete `aarch64-unknown-linux-musl` ReleaseSafe build through the
patched ZAPI 2 CLI
- native host ReleaseSafe bindings build
- frozen pnpm install
- `pnpm lint`
- `zig fmt --check build.zig.zon`
- 236 binding tests passed
- npm package dry run confirms the patched ZAPI 2 dependency is bundled

> This PR was written with AI assistance.

---------

Co-authored-by: matthewkeil <me@matthewkeil.com>
Co-authored-by: bing <spiralladder@fastmail.com>
Co-authored-by: Cayman <caymannava@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants